package com.cet.spring_batch_study.jobs;

import org.springframework.batch.core.Job;
import org.springframework.batch.core.JobInterruptedException;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.job.builder.JobBuilder;
import org.springframework.batch.core.repository.JobRepository;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author NSOC
 */
@Configuration
public class DemoJob {

    @Bean
    public Job footballJob(JobRepository jobRepository) {
        return new JobBuilder("footballJob", jobRepository)
                .preventRestart()
                .start(playerLoad())
                .next(gameLoad())
                .next(playerSummarization())
                .build();
    }

    private Step playerLoad() {
        return new Step() {
            @Override
            public String getName() {

                return "aaa";
            }

            @Override
            public void execute(StepExecution stepExecution) throws JobInterruptedException {

            }
        };
    }

    private Step gameLoad() {
        Object o = null;
        return null;
    }

    private Step playerSummarization() {
        Object o = null;
        return null;
    }
}
